#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// digit convert string
int digit(int n) 
{ 
	int d = 0; 
	do{ 
		++d; 
		n /= 10; 
	}while(n > 0 || n < 0); 

	return d; 
} 

void itoa_(int n, char* des) 
{ 
	if(n > 0) { 
		int x = (int)pow(10.0, digit(n)-1); 
		*des = n / x + '0'; 
		itoa_(n-(n/x)*x, des+1); 
	}
	else { 
		*des = '\0'; 
	}
}


#if defined(__linux__)

#define _itoa   itoa

char* itoa(int value, char*  str, int radix)
{
    int  rem = 0;
    int  pos = 0;
    char ch  = ''!'' ;
    do
    {
        rem    = value % radix ;
        value /= radix;
        if ( 16 == radix )
        {
            if( rem >= 10 && rem <= 15 )
            {
                switch( rem )
                {
                    case 10:
                        ch = ''a'' ;
                        break;
                    case 11:
                        ch =''b'' ;
                        break;
                    case 12:
                        ch = ''c'' ;
                        break;
                    case 13:
                        ch =''d'' ;
                        break;
                    case 14:
                        ch = ''e'' ;
                        break;
                    case 15:
                        ch =''f'' ;
                        break;
                }
            }
        }
        if( ''!'' == ch )
        {
            str[pos++] = (char) ( rem + 0x30 );
        }
        else
        {
            str[pos++] = ch ;
        }
    }while( value != 0 );
    str[pos] = ''\0'' ;
    return strrev(str);
}

#endif

void main()
{
	int num = 100;
	char tmp[10];

	itoa_(num, tmp);
	printf("%s\n", tmp);
}